package com.sdy.dao.mysql;

import com.sdy.po.Order;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper {

    List<Order> getAll();

    Boolean update(@Param("orderItem")Order order);

    Boolean insert(@Param("orderItem")Order order);

    Boolean delete(@Param("id")Integer id);

    @Select("select id,companyId,time,uuid,payTime,totalPrice,salesPersion,state from po_order where companyId = #{id}")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "id",property = "orderItemList",many = @Many(select = "com.sdy.dao.mysql.OrderItemMapper.getListByOrderId"))
    })
    List<Order> getListByCompanyId(@Param("id") Integer id);
}
